package com.luoy.regular;

import cn.hutool.core.lang.PatternPool;
import cn.hutool.core.util.ReUtil;

import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @desc:
 * @author: luoy
 * @date: 2021-11-18 14:14
 */
public class Rule {
    public static void main(String[] args) {


        // -----------------自定义-----------
        //验证ip
        String s1 ="^((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)$";

        //驾照    370861801904
        String s2 = "^[1-8]\\d{11}$";

        // IMEI
        String s3= "\\d{15,17}";

        //户口薄
        String s4= "^\\d{9}$";

        //IMSI效验  460030912121001
        String s5 ="^4600[0,1,2,3,5,6,7]\\d{10}$";

        String s6 ="(01|03)(\\d{2})(\\w{1})(\\w{1})(\\d{3})(\\d{6})(\\w{1})";

        // 机动车号码
        String s7 = "^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";

        //邮政编码 ^[1-9]\\d{5}$
        String s8 = "^[1-9]\\d{5}$";

        // 银行账号 ^([1-9]{1})(\d{14}|\d{18})$
        String s9 = "^([1-9]{1})(\\d{14}|\\d{18})$";

        // 网址
        String s10 = "[a-zA-z]+://[^s]*";

        //港澳通行证
        String s11 = "^[a-zA-Z0-9]{6,10}$";

        //纬度
        String s12 = "((^[0-9])|(^[1-8]([0-9])?))(([-](([0-9])|([0-5][0-9])))?){1,2}$";

        //经度
        String s13 = "((^[0-9])|(^[2-9]([0-9])?)|(^[1](([0-7])?)(([0-9])?)))(([-](([0-9])|([1-5][0-9])))?){1,2}$";

        //select ifnull(b - a,0),ifnull(a,0), ifnull(b,0),ifnull(a/b, 1) from ( select ( select count(1) as a from ${Schema_Table1} where ${Column1} regexp '^[1-9]\\d{5}$' ) a,( select count(1) as b from ${Schema_Table1} ) b ) c

        // 日期合法
        // Thu Nov 18 17:31:38 CST 2021
        // 2021-10-20 17:16:42
        //^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$
        String s14 = "^((25[0-5]|2[0-4]\\\\d|((1\\\\d{2})|([1-9]?\\\\d)))\\\\.){3}(25[0-5]|2[0-4]\\\\d|((1\\\\d{2})|([1-9]?\\\\d)))$";

        String s15 = "^\\d{4}-\\d{1,2}-\\d{1,2}";

        // 手机号码
        String s16 = "^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}$";

        //电话号码
        String s17 = "^(\\(\\d{3,4}-)|\\d{3,4}-)?\\d{7,8}$";


        //----------------系统模版-------------------------

        // 邮编格式 100000
        String s18 = "^\\d{6}$";

        // 电话格式
        String s19 = "^(\\+\\d{2}-)?(\\d{2,3}-)?([1][3,4,5,7,8][0-9]\\d{8})$";

        // ip校验
        String s20 = "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$";


        // 邮箱校验 869441600@qq.com
        String s21 = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$";

        //身份证校验
        String s22= "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)";

       // boolean sss = Pattern.matches(s22, "622723199403231411w");





        // mac校验  14:7d:da:1b:29:4f
        String s23 = "((([a-f0-9]{2}:){5})|(([a-f0-9]{2}-){5}))[a-f0-9]{2}";

        String sss="^[A-F0-9]{2}([-:]?[A-F0-9]{2})([-:.]?[A-F0-9]{2})([-:]?[A-F0-9]{2})([-:.]?[A-F0-9]{2})([-:]?[A-F0-9]{2})$";



        // 日期 2021-10-23
        String s24 = "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s((([0-1][0-9])|(2?[0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$";


        // 航班号 GS7615
        String s25 = "^[A-Z\\d]{2}\\d{3,4}$";

        // 护照  EJI375608

        String s26 = "^([a-zA-z]|[0-9]){5,17}$";



        //imei
        String s28 = "\\d{15,17}$";

        //营业执照
        String s29= "^[a-zA-Z0-9]{10,20}$";
        String r29 = "91341024MA2UXG2X4C";

        System.out.println(r29.length());

        boolean match = ReUtil.isMatch(s4, "123456789");
        System.out.println(match);
    }
}
